import React, { useContext } from 'react';
import { Row, Col } from 'antd';
import { ExpertsUpdateContext } from '../common/ExpertsContext';
import { DictionarySpan, DictionarySpans } from '../common/Format';

const UpdateExpertsFormBaseInfoView: React.FC = () => {
  const { prefixCls, expertsInfo } = useContext(ExpertsUpdateContext);

  const {
    fullName,
    educateLevelName,
    rankTypeName,
    talentTypeName,
    overseaTypeName,
    companyName,
    positionName,
    phoneMobile,
    sex,
    addressInfo,
    graduateSchool,
    emailNum,
  } = expertsInfo;

  const getSexText = (sex: number | null) => {
    let text = '--';
    switch (sex) {
      case 0:
        text = '未知';
        break;
      case 1:
        text = '先生';
        break;
      case 2:
        text = '女士';
        break;
    }
    return text;
  };

  return (
    <Row className={`${prefixCls}info-view`}>
      <Col span={12}>
        <span className={'label'}>专家姓名：</span>
        <span>{fullName ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>性别：</span>
        <span>{getSexText(sex)}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>所在单位：</span>
        <span>{companyName ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>所在地：</span>
        <span>{addressInfo ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>职务：</span>
        <span>{positionName ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>职称：</span>
        <span>{DictionarySpan(rankTypeName) ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>最高学历：</span>
        {DictionarySpan(educateLevelName) ?? '--'}
      </Col>

      <Col span={12}>
        <span className={'label'}>毕业院校：</span>
        <span>{graduateSchool ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>人才称号：</span>
        <span>{DictionarySpans(talentTypeName) ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>海外经历：</span>
        <span>{DictionarySpans(overseaTypeName) ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>联系电话：</span>
        <span>{phoneMobile ?? '--'}</span>
      </Col>

      <Col span={12}>
        <span className={'label'}>邮箱：</span>
        <span>{emailNum ?? '--'}</span>
      </Col>
    </Row>
  );
};

export default UpdateExpertsFormBaseInfoView;

{
  /* <Col span={12}>
        <span className={'label'}>所在地：</span>
        <span>{renderRegionText({ provinceCodeName, cityCodeName, countyCodeName }) || '--'}</span>
      </Col> */
}
{
  /* <Col span={12}>
        <span className={'label'}>专家级别：</span>
        {DictionarySpan(expertLevelName) ?? '--'}
      </Col> */
}
{
  /* <Col span={12}>
        <span className={'label'}>专家类型：</span>
        {DictionarySpan(expertTypeName) ?? '--'}
      </Col> */
}

{
  /* <Col span={12}>
        <span className={'label'}>办公电话：</span>
        <span>{phoneOffice ?? '--'}</span>
      </Col>
      <Col span={12}>
        <span className={'label'}>备用手机：</span>
        <span>{phoneSpare ?? '--'}</span>
      </Col> */
}

{
  /* <Col span={12}>
 <span className={'label'}>专家头像：</span>
 <span>{
     imageInfo ?
         <Image
             width={'150px'}
             height={'150px'}
             src={imageInfo}
         />
         :
         '--'
 }
 </span>
</Col> */
}

// <Row className={`${prefixCls}info-view`}>
//     <Col span={12}>
//         <span className={'label'}>专家姓名：</span>
//         <span>{fullName ?? '--'}</span>
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>是否启用：</span>
//         <span className={`${isOpen == '1' ? 'correct' : 'deny'}`}>{isOpen == '1' ? '是' : '否'}</span>
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>专家类型：</span>
//         {DictionarySpan(expertTypeName) ?? '--'}
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>最高学历：</span>
//         {DictionarySpan(educateLevelName) ?? '--'}
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>专家级别：</span>
//         {DictionarySpan(expertLevelName) ?? '--'}
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>所在地：</span>
//         <span>{renderRegionText({ provinceCodeName, cityCodeName, countyCodeName }) || '--'}</span>
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>所在地：</span>
//         <span>{addressInfo ?? '--'}</span>
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>所在单位：</span>
//         <span>{companyName ?? '--'}</span>
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>所在部门：</span>
//         <span>{deptName ?? '--'}</span>
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>是否在岗：</span>
//         <span className={`${isDuty == '1' ? 'correct' : 'deny'}`}>{isDuty == '1' ? '是' : '否'}</span>
//     </Col>
//     <Col span={12}>
//         <span className={'label'}>职务：</span>
//         <span>{positionName ?? '--'}</span>
//     </Col>
// </Row >
